import { getDataItem } from "@/api/workFlow/WFLaunch";
const flow = {
  state: {
    workflowCategory:[],
    currentModule:''
  },
  mutations: {
    CHANGE_FLOWCATEGORY: (state, value) => {
      state.workflowCategory = value;
    },
    CHANGE_CURRENT_MODULE: (state, value) => {
      state.currentModule = value;
    }
  },
  actions: {
    async updatewWorkFlowCategory({ state, commit }) {
      if (state.workflowCategory.length > 0) {
        return state.workflowCategory;
      } else {
        // let res = await getDataItem("FlowSort");
        let res = await getDataItem("yjy");
        if (res.data.success) {
          commit("CHANGE_FLOWCATEGORY", res.data.data);
          return res.data.data;
        }else{
          return [];
        }
      }
    }
  }
};
export default flow;
